(function (lib, config) {
    var loadFunc = function () {
        var textAry = config.words.split('|'), bgcolorAry = config.bgcolor.split('|'), textcolorAry = config.textcolor.split('|'), imglinkAry = config.imglink.split('|'), weblinkAry = config.weblink.split('|'), identifier = config.identifier.split('|');
        textAry[0] = textAry[0] || '男性问题请在线提问或拨打专家热线，';
        textAry[1] = textAry[1] || '该电话已全程加密，请您放心拨打。';
        textAry[2] = textAry[2] || '0451-84832055';
        imglinkAry[0] = imglinkAry[0] || 'http://m.hebjlnk.com/swt/20180309qdswt/img/swt-pic1.png';
        imglinkAry[1] = imglinkAry[1] || 'http://m.hebjlnk.com/swt/20180309qdswt/img/swtc_gb1.png';
        identifier[0] = identifier[0] || 'swt_zhongjian';
        /*TODO 方法*/
        function getScrollTop() {
            var scrollTop = 0;
            if (document.documentElement && document.documentElement.scrollTop) {
                scrollTop = document.documentElement.scrollTop;
            }
            else if (document.body) {
                scrollTop = document.body.scrollTop;
            }
            return scrollTop;
        }
        function getClientHeight() { //获取可视高度
            var clientHeight = 0;
            if (document.body.clientHeight && document.documentElement.clientHeight) {
                var clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
            }
            else {
                var clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
            }
            return clientHeight;
        }
        var _ua = navigator.userAgent, _ua_text = false, _position = "fixed";
        if (config.iscomapp==1 && _ua.indexOf('baiduboxapp') > -1) {
            _ua_text = true; _position = "absolute";
        }
        config.width = 296, config.height = 310;
        var strVar = [];
        strVar.push("<style type=\"text/css\">#zjswt{position:" + _position + "!important; _position:absolute;border-radius:10px;box-sizing:border-box; display:none;overflow: visible; width:296px; height:310px; box-shadow:0 0 4px rgba(0, 0, 0, 0.3); position:fixed; z-index:9999; padding:0;"+lib.util.getPosStyle(config)+";background: #fff; }<\/style>");/*left:50%; margin:-155px 0 0 -148px*/
        strVar.push("<div id=\'zjswt\' style=\'\'>");/*top:50%;*/
        strVar.push("	<div style=\'width: 100%; box-sizing:border-box;text-align:center; position:absolute; z-index:-1; top:-42px; right:0; padding:0; margin:0;\'><img style=\' box-sizing:border-box; width:100%;vertical-align:top; border:0; padding:0; margin:0;\' src=\'" + imglinkAry[0] + "\'></div>");
        strVar.push("	");
        strVar.push("    <div style=\' box-sizing:border-box;width:40px;height:40px; position:absolute; z-index:1; top:-17px; right:-5px; cursor:pointer; padding:0; margin:0;\' onclick=\'popCancel()\'><img style=\' box-sizing:border-box;vertical-align:top; border:0; width:100%; padding:0; margin:0;\' src=\'" + imglinkAry[1] + "\'></div>");
        strVar.push("	");
        strVar.push("	");
        strVar.push("    <div style=\' box-sizing:border-box;text-align:center;    height: 40px; margin:160px 0 11px; padding:0;\'><input  style=\' width:185px; height:38px; background:#fff; border:#ccc 1px solid; box-sizing:border-box; border-right:0; border-radius:10px 0 0 10px; padding:0 0 0 10px; margin:0; font-size:22px; color:#999; vertical-align:top;\' placeholder=\'" + textAry[2] + "\' type=\'text\' /><button style=\' cursor:pointer; width:86px; height:38px; background:#f27406; border-radius:0 10px 10px 0; border:0; color:#fff; font-size:18px; padding:0; margin:0; box-sizing:border-box; vertical-align:top; font-family:Microsoft YaHei;\' /><a href=\'tel:" + textAry[2] + "\' style=\'color:#fff;\'>拨打电话</button></div>");
        strVar.push("	");
        strVar.push("	");
        strVar.push("    <div style=\' box-sizing:border-box; text-align:center; font-size:16px; line-height:22px; color:#999999; padding:0; margin:0;\'>" + textAry[0] + "<br>" + textAry[1] + "</div>");
        strVar.push("    <div style=\' box-sizing:border-box;position:absolute; z-index:2; bottom:0; left:0; width:100%; height:45px; vertical-align:top; text-align:center; padding:0; margin:0;\'><a onclick=\"openZoosUrl('" + identifier[0] + "');\" style=\'text-decoration: none; box-sizing: border-box; display: inline-block;float: left; width: 50%; height: 45px; line-height: 45px; color: rgb(255, 255, 255); font-size: 18px; border-radius: 0 0 0 10px; padding: 0; margin: 0; background: rgb(242, 116, 6) none repeat scroll 0% 0%;\'><img style=\' box-sizing:border-box;width:27px;display: inline-block; vertical-align:middle; border:0; padding:0; margin:0 3px 0 0;\' src=\'http://m.hebjlnk.com/swt/20180309qdswt/img/swtc_bt11.gif\'>悄悄提问</a><a href=\'tel:" + textAry[2] + "\' style=\'text-decoration: none; box-sizing: border-box; display: inline-block;float: right; width: 50%; height: 45px; line-height: 45px; color: rgb(255, 255, 255); font-size: 18px; border-radius: 0 0 10px; padding: 0; margin: 0; background: rgb(22, 124, 196) none repeat scroll 0% 0%;\'><img style=\' box-sizing:border-box;width:27px; vertical-align:middle;display: inline-block; border:0; padding:0; margin:0 3px 0 0;\' src=\'http://m.hebjlnk.com/swt/20180309qdswt/img/swtc_bt21.gif\'>私密通话</a></div>");
        strVar.push("</div>");
        var o = document.createElement('div');
        o.innerHTML = strVar.join('');
        while (o.firstElementChild) {
            document.body.appendChild(o.firstElementChild);
        };



        setTimeout(function () {
            document.getElementById("zjswt").style.display = "block";
            if (config.eachtime > 0) setTimeout(popCancel,config.eachtime*1000);
        }, config.firsttime * 1000)

        popCancel = function () {

            document.getElementById("zjswt").style.display = "none";

            setTimeout(function () { zjswt.style.display = 'block'; }, config.relapsetime * 1000);

        }


        if (_ua_text) {
            var _t = document.getElementById('zjswt').style.top;

            if (_t == '') { _t = 0; }
            addEvent(window, 'scroll', function () {
                document.getElementById('zjswt').style.top = parseInt('50%') + (getScrollTop() / getClientHeight()) * 100 + '%';
            });

        }

        function addEvent(obj, type, fn) {
            if (obj.attachEvent) {
                obj.attachEvent('on' + type, function () {
                    fn.call(obj);
                })
            } else {
                obj.addEventListener(type, fn, false);
            }
        }

    };
    lib.load(loadFunc);/*执行代码*/
})('{{lib}}', '{{config}}');
